<?php namespace Home\Model;
use Hdphp\Model\Model;
class Order extends Model{
//  指定表名
    protected $table = "orders";
//  添加
    public function store($data,$key){
		//备注说明
    	$remark = Q("post.remark");
	
		$num = 0;
		foreach ($key as $k => $v) {
			$num = $num + $_SESSION['cart']['goods'][$v]['total'];
		}
		$data = [
			'consignee'=>$data['consignee'],
			'address'=>$data['area'].$data['address'],
			'mobile'=>$data['mobile'],
			'telephone'=>$data['telephone'],
			'total'=>$num,
			'user_uid'=>$_SESSION['user']['uid'],
			'number'=>$data['number'],
			'time'=>time(),
			'remark'=>$remark
		];
		//返回自增id
		$oid = $this->add($data);
		return $oid;
    }
}